package com.muc.util;

import javax.swing.*;
import java.awt.*;

//获取屏幕大小的工具类
public class DimensionUtil {

    public static Rectangle getBounds(){
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        //保证主界面不会覆盖电脑屏幕的任务栏
        //获取屏幕内
        Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(new JFrame().getGraphicsConfiguration());
        return new Rectangle(screenInsets.left,screenInsets.top,
                screenSize.width-screenInsets.left-screenInsets.right,
                screenSize.height-screenInsets.top-screenInsets.bottom);

    }
}
